<template>
  <div>
    <button @click="btn">向父组件传值</button>
    <!-- <header>
      <slot name="header"></slot>
    </header>
    <main>
      <slot :obj="obj"></slot>
    </main>
    <footer>
      <slot name="footer"></slot>
    </footer>-->
  </div>
</template>

<script>
export default {
  props: ["num"],
  data() {
    return {
      obj: {
        name: "slh",
        age: 20
      }
    };
  },
  methods: {
    btn() {
      this.$emit("parentNode", this.obj);
    }
  },
  mounted() {
    console.log(this.num);
  }
};
</script>

<style>
</style>